package com.example.myapplication.shortvideo;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.os.Bundle;
import android.view.animation.LinearInterpolator;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.example.myapplication.R;
import com.example.myapplication.databinding.ActivityTest2Binding;


public class Test2Activity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActivityTest2Binding binding = DataBindingUtil.setContentView(
                this, R.layout.activity_test2);

        ObjectAnimator alpha = ObjectAnimator.ofFloat(binding.viewHeadBorder, "alpha", 1f, 0f).setDuration(800);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(binding.viewHeadBorder, "scaleX", 1, 1.2f).setDuration(800);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(binding.viewHeadBorder, "scaleY", 1, 1.2f).setDuration(800);
        alpha.setRepeatCount(ValueAnimator.INFINITE);
        scaleX.setRepeatCount(ValueAnimator.INFINITE);
        scaleY.setRepeatCount(ValueAnimator.INFINITE);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(alpha, scaleX, scaleY);
        animatorSet.setDuration(800);
        animatorSet.setInterpolator(new LinearInterpolator());
        animatorSet.start();
    }
}